<template>
  <div class="box">
    <el-form
      ref="ruleFormRef"
      :model="contractForm"
      label-position="top"
      label-width="120px"
      :inline="true"
      :rules="rules"
      class="demo-form-inline"
    >
      <el-form-item class="page-list" label="项目名称:" required prop="projectId">
        <el-input v-model="contractForm.projectName" disabled placeholder="请选择中咨项目" />
        <el-button
          :disabled="title != '新增合同'"
          class="choose-btn"
          @click="handleProject"
          type="primary"
          >选择项目</el-button
        >
      </el-form-item>
      <el-form-item class="page-list" label="合同名称:" required prop="contractName">
        <!-- <el-input v-model="contractForm.contractName" disabled placeholder="请选择项目关联的合同" />
        <el-button
          :disabled="title != '新增合同'"
          class="choose-btn"
          @click="handleContract"
          type="primary"
          >选择合同</el-button
        > -->
        <el-select
          :disabled="title != '新增合同'"
          v-model="contractForm.contractName"
          no-data-text="该项目暂无关联合同"
          placeholder="请选择"
          @change="getContract"
        >
          <el-option
            v-for="item in data.contractList"
            :key="item.pk_contract_main"
            :label="item.contract_name"
            :value="item.pk_contract_main"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="项目主数据编码:">
        <el-input v-model="contractForm.projectMainDataCode" disabled placeholder="项目关联带入" />
      </el-form-item>
      <el-form-item label="合同编号:">
        <el-input v-model="contractForm.contractNumber" disabled placeholder="合同关联带入" />
      </el-form-item>
      <el-form-item label="合同主数据编码:">
        <el-input v-model="contractForm.contractMainDataCode" disabled placeholder="主数据编码" />
      </el-form-item>
      <el-form-item label="合同类型:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.contractType"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_TYPE"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="合同性质:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.contractNature"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_NATURE"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="原合同主数据编码:" v-if="contractForm.contractNature == '2'">
        <el-input
          disabled
          v-model="contractForm.originalContractMainDataCode"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="原合同名称:" v-if="contractForm.contractNature == '2'">
        <el-input disabled v-model="contractForm.originalContractName" placeholder="自动关联回显" />
      </el-form-item>
      <el-form-item label="合同变更后总金额:" v-if="contractForm.contractNature == '2'">
        <el-input v-model="contractForm.contractAmendedTotalAmount" placeholder="自动关联回显" />
      </el-form-item>
      <el-form-item label="申请单位:">
        <popup-tree-input
          :disabled="title.includes('详情')"
          :props="data.deptTreeProps"
          :data="orgList"
          :prop="contractForm.applyingUnitName"
          :current-change-handle="handleApplyingUnit"
        />
        <!-- <el-input disabled v-model="contractForm.applyingUnitName" placeholder="自动关联回显" /> -->
      </el-form-item>
      <el-form-item label="甲方:">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.partyA"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="乙方:">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.partyB"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="合同签订方式:">
        <!-- <el-select v-model="contractForm.contractSigningMethodName" placeholder="自动关联回显">
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_SIGN_TYPE"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select> -->
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.contractSigningMethodName"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="合同语言:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.contractLanguage"
          filterable
          @change="changeContractLanguage"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.conLanguage"
            :key="item.zlang_bib"
            :label="item.zlang_zh"
            :value="item.zlang_bib"
          />
        </el-select>
        <!-- <el-input disabled v-model="contractForm.contractLanguageName" placeholder="自动关联回显" /> -->
      </el-form-item>
      <el-form-item label="是否涉及多方:">
        <el-radio-group
          :disabled="title.includes('详情')"
          v-model="contractForm.involvesMultipleParties"
          class="radio"
        >
          <el-radio label="是" size="large">是</el-radio>
          <el-radio label="否" size="large">否</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="暂定金(万元):">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.provisionalSum"
          type="text"
          @input="contractForm.provisionalSum = NumberCheck(contractForm.provisionalSum)"
          :maxlength="10"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="合同金额(万元):" required prop="contractAmount">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.contractAmount"
          type="text"
          @input="contractForm.contractAmount = NumberCheck(contractForm.contractAmount)"
          :maxlength="10"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="税率(%):">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.taxRate"
          type="text"
          @input="contractForm.taxRate = NumberCheck(contractForm.taxRate)"
          :maxlength="10"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="税额:">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.taxAmount"
          type="text"
          @input="contractForm.taxAmount = NumberCheck(contractForm.taxAmount)"
          :maxlength="10"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="合同净额(万元):">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.contractNetAmount"
          type="text"
          @input="contractForm.contractNetAmount = NumberCheck(contractForm.contractNetAmount)"
          :maxlength="10"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="项目承担单位:">
        <popup-tree-input
          :disabled="title.includes('详情')"
          :props="data.deptTreeProps"
          placeholder="自动关联回显"
          :data="orgList"
          :prop="contractForm.projectUndertakingUnitName"
          :current-change-handle="handleProjectUndertakingUnit"
        />
        <!-- <el-input
          disabled
          v-model="contractForm.projectUndertakingUnitName"
          placeholder="自动关联回显"
        /> -->
      </el-form-item>
      <el-form-item label="业务版块:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.businessSector"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.XMZX_HTGL_YWBK"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="签订日期:">
        <el-date-picker
          :disabled="title.includes('详情')"
          v-model="contractForm.signingDate"
          value-format="YYYY-MM-DD HH:mm:ss"
          type="date"
          :disabled-date="disabledSigningDate"
          placeholder="自动关联回显"
          clearable
        />
      </el-form-item>
      <el-form-item label="盖章日期:">
        <el-date-picker
          :disabled="title.includes('详情')"
          v-model="contractForm.stampingDate"
          value-format="YYYY-MM-DD HH:mm:ss"
          type="date"
          :disabled-date="disabledStampingDate"
          placeholder="自动关联回显"
          clearable
        />
      </el-form-item>

      <el-form-item label="规定开工日期:">
        <el-date-picker
          :disabled="title.includes('详情')"
          v-model="contractForm.scheduledStartDate"
          value-format="YYYY-MM-DD HH:mm:ss"
          type="date"
          :disabled-date="disabledStartDate"
          placeholder="自动关联回显"
          clearable
        />
      </el-form-item>
      <el-form-item label="规定完工日期:">
        <el-date-picker
          :disabled="title.includes('详情')"
          v-model="contractForm.scheduledCompletionDate"
          value-format="YYYY-MM-DD HH:mm:ss"
          type="date"
          :disabled-date="disabledEndDate"
          placeholder="自动关联回显"
          clearable
        />
      </el-form-item>
      <el-form-item label="合同履行地(国家):">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.performanceCountry"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="合同履行地(省):">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.performanceProvince"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="合同履行地(市):">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.performanceCity"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="项目起点省:">
        <!-- <el-input
          disabled
          v-model="contractForm.projectStartProvinceName"
          placeholder="自动关联回显"
        /> -->
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.projectStartProvince"
          @change="changeStartProvince"
          placeholder="请选择"
        >
          <el-option
            v-for="item in projectStartProvinceList"
            :key="item.regionCode"
            :label="item.regionName"
            :value="item.regionCode"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="项目起点市:">
        <!-- <el-input disabled v-model="contractForm.projectStartCityName" placeholder="自动关联回显" /> -->
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.projectStartCity"
          no-data-text="请选择起点省"
          @change="changeStartCity"
          placeholder="请选择"
        >
          <el-option
            v-for="item in (data.projectStartCityList as any)"
            :key="item.regionCode"
            :label="item.regionName"
            :value="item.regionCode"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="项目终点省:">
        <!-- <el-input
          disabled
          v-model="contractForm.projectEndProvinceName"
          placeholder="自动关联回显"
        /> -->
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.projectEndProvince"
          @change="changeEndProvince"
          placeholder="请选择"
        >
          <el-option
            v-for="item in projectStartProvinceList"
            :key="item.regionCode"
            :label="item.regionName"
            :value="item.regionCode"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="项目终点市:">
        <!-- <el-input disabled v-model="contractForm.projectEndCityName" placeholder="自动关联回显" /> -->
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.projectEndCity"
          no-data-text="请选择终点省"
          @change="changeEndCity"
          placeholder="请选择"
        >
          <el-option
            v-for="item in (data.projectEndCityList as any)"
            :key="item.regionCode"
            :label="item.regionName"
            :value="item.regionCode"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="里程(KM):">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.mileage"
          type="text"
          @input="contractForm.mileage = NumberCheck(contractForm.mileage)"
          :maxlength="10"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="业务类型:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.businessType"
          @change="changeBusinessType"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.businessType"
            :key="item.pk_busitype"
            :label="item.busitype_value"
            :value="item.pk_busitype"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="业务类型细分:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.businessSubtype"
          no-data-text="请选择业务类型"
          @change="changeBusinessSubtype"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in data.businessSubtypeList"
            :key="item.pk_busitype"
            :label="item.busitype_value"
            :value="item.pk_busitype"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="工程类型:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.engineeringType"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_ENGINEERING_TYPE"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="工程阶段:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.engineeringPhase"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_ENGINEERING_PHASE"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="项目负责人:">
        <user-list-modal
          :disabled="title.includes('详情')"
          v-model="contractForm.projectLeaderName"
          @update:modelValue="handleProjectLeader"
          :default-users="[]"
          :multiple="false"
          :devType="'platform'"
        />
      </el-form-item>
      <el-form-item label="合同业务类型:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.contractBusinessType"
          @change="changeConBusinessType"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.conBusinessType"
            :key="item.pk"
            :label="item.busitype_value"
            :value="item.pk"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="合同业务类型细分:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.contractBusinessSubtype"
          no-data-text="请选择合同业务类型"
          @change="changeConBusinessSubtype"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in data.contractBusinessSubtypeList"
            :key="item.pk"
            :label="item.busitype_value"
            :value="item.pk"
          />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="合同表单类型:">
        <el-input disabled v-model="contractForm.contractFormType" placeholder="自动关联回显" />
      </el-form-item> -->
      <el-form-item label="收支类型:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.inpayType"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_PAY_TYPE"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="争议解决方式:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.disputeResolutionMethod"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_DISPUTE_METHOD"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="合同范本使用情况:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.contractTemplateUsage"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_TEMPLATES_USE"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="合同承办人:">
        <user-list-modal
          :disabled="title.includes('详情')"
          v-model="contractForm.contractHandlerName"
          @update:modelValue="handleContractHandler"
          :default-users="[]"
          :multiple="false"
          :devType="'platform'"
        />
      </el-form-item>
      <el-form-item label="合同承办人联系方式:" prop="contractHandlerContact">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.contractHandlerContact"
          maxlength="11"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="管理部门:">
        <popup-tree-input
          :disabled="title.includes('详情')"
          :props="data.deptTreeProps"
          placeholder="自动关联回显"
          :data="orgList"
          :prop="contractForm.managementDepartmentName"
          :current-change-handle="handleManagementDepartment"
        />
      </el-form-item>
      <el-form-item label="合同实际履约主体:">
        <!-- <popup-tree-input
          :props="data.deptTreeProps"
          placeholder="自动关联回显"
          :data="orgList"
          :prop="contractForm.ourContractingPartyName"
          :current-change-handle="handleOurContractingParty"
        /> -->
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.actualPerformanceSubject"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="我方签约单位:">
        <popup-tree-input
          :disabled="title.includes('详情')"
          :props="data.deptTreeProps"
          placeholder="自动关联回显"
          :data="orgList"
          :prop="contractForm.ourContractingPartyName"
          :current-change-handle="handleOurContractingParty"
        />
      </el-form-item>
      <el-form-item label="合同状态:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.contractStatus"
          placeholder="自动关联回显"
          @change="changeContractStatus"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.XMZX_CONTRACT_STATUS"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemText"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="总金额币种:">
        <el-select
          :disabled="title.includes('详情')"
          filterable
          v-model="contractForm.totalAmountCurrency"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.currencies"
            :key="item.zcurrencycode"
            :label="item.zcurrencyname"
            :value="item.zcurrencyname"
          />
        </el-select>
      </el-form-item>
      <el-form-item disabled label="产值填报方式:">
        <!-- <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.outputReportingMethod"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_OUTPUT_REPORTING_METHOD"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select> -->
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.outputReportingMethod"
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="收入类型:">
        <popup-tree-input
          :disabled="title.includes('详情')"
          placeholder="自动关联回显"
          :data="store.state.projectCenter.incomeType"
          :prop="contractForm.incomeTypeName"
          :props="{}"
          :current-change-handle="handleBusinessType"
        />
      </el-form-item>
      <el-form-item label="是否提交企业法人签批:">
        <el-radio-group
          :disabled="title.includes('详情')"
          v-model="contractForm.submittedToLegalPersonApproval"
          class="radio"
        >
          <el-radio label="1" size="large">是</el-radio>
          <el-radio label="0" size="large">否</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="是否准许使用法人章:">
        <el-radio-group
          :disabled="title.includes('详情')"
          v-model="contractForm.legalPersonSealPermission"
          class="radio"
        >
          <el-radio label="1" size="large">是</el-radio>
          <el-radio label="0" size="large">否</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="持有合同份数:">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.numberOfContractCopiesName"
          maxlength="3"
          type="text"
          @input="
            contractForm.numberOfContractCopiesName = contractForm.numberOfContractCopiesName.replace(
              /^(0+)|[^\d]+/g,
              ''
            )
          "
          placeholder="自动关联回显"
        />
      </el-form-item>
      <el-form-item label="入库方式:" prop="storageMethod">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.storageMethod"
          placeholder="自动关联回显"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_WAREHOUSING_METHOD"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="是否为重要项目:">
        <el-radio-group
          :disabled="title.includes('详情')"
          v-model="contractForm.importantProject"
          class="radio"
        >
          <el-radio label="1" size="large">是</el-radio>
          <el-radio label="0" size="large">否</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="合同分类:">
        <el-select
          :disabled="title.includes('详情')"
          v-model="contractForm.contractClassification"
          placeholder="请选择"
        >
          <el-option
            v-for="item in store.state.projectCenter.contratDict.KHGL_HTGL_CONTRACT_CLASSIFICATION"
            :key="item.itemValue"
            :label="item.itemText"
            :value="item.itemValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="部门领导会签:">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.departmentLeaderApproval"
          placeholder="请输入"
        />
      </el-form-item>
      <el-form-item label="公司领导会签:">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.companyLeaderApproval"
          placeholder="请输入"
        />
      </el-form-item>
      <el-form-item label="是否需要相关主管认领:">
        <el-radio-group
          :disabled="title.includes('详情')"
          v-model="contractForm.requiresRelatedManagerApproval"
          class="radio"
        >
          <el-radio label="1" size="large">是</el-radio>
          <el-radio label="0" size="large">否</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="是否使用法人章:">
        <el-radio-group
          :disabled="title.includes('详情')"
          v-model="contractForm.useLegalPersonSeal"
          class="radio"
        >
          <el-radio label="1" size="large">是</el-radio>
          <el-radio label="0" size="large">否</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="是否需要总经理审批:">
        <el-radio-group
          :disabled="title.includes('详情')"
          v-model="contractForm.requiresGeneralManagerApproval"
          class="radio"
        >
          <el-radio label="1" size="large">是</el-radio>
          <el-radio label="0" size="large">否</el-radio>
        </el-radio-group>
      </el-form-item>
      <br />
      <el-form-item label="备注:" style="width: 100%">
        <el-input
          :disabled="title.includes('详情')"
          v-model="contractForm.remarks"
          :rows="3"
          type="textarea"
          placeholder="自动关联回显"
        />
      </el-form-item>
    </el-form>
    <ContractTable
      v-if="data.contractDialog"
      :projectCode="contractForm.projectMainDataCode"
      @closeDialog="handleDialog"
      @getContract="getContract"
    ></ContractTable>
    <el-dialog v-model="data.projectDialog" width="60%" title="选择项目">
      <ProjectTable
        ref="projectRef"
        v-if="data.projectDialog"
        @getProject="getProject"
      ></ProjectTable>
      <template #footer>
        <el-button @click="data.projectDialog = false">关闭</el-button>
      </template>
    </el-dialog>
    <el-dialog v-model="data.currencyDialog" width="60%" title="选择项目">
      <CurrencyTable ref="currencyRef" v-if="data.currencyDialog"></CurrencyTable>
      <template #footer>
        <el-button @click="data.currencyDialog = false">关闭</el-button>
        <el-button type="primary" @click="getCurrency">确认</el-button>
      </template>
    </el-dialog>
  </div>
</template>
<script lang="ts">
import UserListModal from '@/views/project/components/UserListModal/index.vue'
import PopupTreeInput from '@/views/project/components/PopupTreeInput/index.vue'
import ContractTable from './contract-table.vue'
import ProjectTable from './project-table.vue'
import CurrencyTable from './currency-table.vue'

import { ElMessage } from 'element-plus'
import { computed, defineComponent, reactive, ref, watch } from 'vue'
import { useStore } from 'vuex'
import { ergodicDickName, ergodicListName, ergodicTreeName, NumberCheck } from '@/utils/utils'
import { getZhongziApi } from '@/views/project/api/commom'
import { encryption } from '@/utils/encryption'
import { servicesLoading } from '@/utils/loading'

export default defineComponent({
  components: {
    ProjectTable,
    ContractTable,
    CurrencyTable,
    PopupTreeInput,
    UserListModal,
  },
  props: {
    title: {
      type: String,
      default: '',
    },
  },
  setup() {
    const store = useStore()
    let ZhongziConfig = reactive(store.state.projectCenter.ZhongziConfig)
    const data = reactive({
      contractDialog: false,
      projectDialog: false,
      currencyDialog: false,
      contractList: [] as any,
      projectStartCityList: [],
      projectEndCityList: [],
      businessSubtypeList: [] as any,
      contractBusinessSubtypeList: [] as any,
      deptTreeProps: {
        label: 'name',
        children: 'children',
      },
      params: reactive({
        appcode: ZhongziConfig.appcode,
        username: ZhongziConfig.username,
        password: ZhongziConfig.password,
        pkdept: ZhongziConfig.pkdept,
        pageNo: 1,
        pageSize: 20,
        keyWord: '',
        primaryKey: '',
        projectCodes: '',
        pk_contract_main: '',
      }),
    })
    const ruleFormRef = ref()
    const rules = reactive({
      projectId: { required: true, message: '请选择项目' },
      contractName: { required: true, message: '请选择合同' },
      contractType: { required: true, message: '请选择合同类型' },
      applyingUnit: { required: true, message: '请选择申请单位' },
      partyA: { required: true, message: '请输入甲方' },
      partyB: { required: true, message: '请输入乙方' },
      contractSigningMethodName: { required: true, message: '请选择合同签订方式' },
      contractLanguage: { required: true, message: '请选择合同语言' },
      provisionalSum: { required: true, message: '请输入暂定金' },
      contractAmount: { required: true, message: '请输入合同金额' },
      contractNetAmount: { required: true, message: '请输入合同净额' },
      signingDate: { required: true, message: '请选择签订日期' },
      stampingDate: { required: true, message: '请选择盖章日期' },
      projectUndertakingUnit: { required: true, message: '请选择项目承担单位' },
      scheduledStartDate: { required: true, message: '请选择规定开工日期' },
      scheduledCompletionDate: { required: true, message: '请选择规定完工日期' },
      businessType: { required: true, message: '请选择业务类型' },
      businessSubtype: { required: true, message: '请选择业务细分类型' },
      projectLeader: { required: true, message: '请选择项目负责人' },
      contractBusinessType: { required: true, message: '请选择合同业务类型' },
      contractBusinessSubtype: { required: true, message: '请选择合同业务细分类型' },
      contractHandlerContact: [
        {
          pattern: /^1[3456789]\d{9}$/,
          message: '请输入正确的手机号',
        },
      ],
    })
    let orgList = JSON.parse(JSON.stringify(store.state.projectCenter.orgList))
    let allOrgList = JSON.parse(JSON.stringify(store.state.projectCenter.allOrgList))

    const contractForm = reactive(store.state.projectCenter.contractForm)
    const contratDict = reactive(store.state.projectCenter.contratDict)

    const projectStartProvinceList = store.state.projectCenter.allLocationList[0]?.children
    const handleProject = () => {
      data.projectDialog = true
    }
    const handleContract = () => {
      if (contractForm.projectMainDataCode == '') {
        ElMessage({
          message: '请先选择关联项目',
          type: 'warning',
        })
      } else {
        data.contractDialog = true
      }
    }
    //选择项目负责人的回调
    const handleProjectLeader = (user) => {
      console.log(user, 'handleProjectLeader')
      contractForm.projectLeader = user.userId
      contractForm.projectLeaderName = `${user.cname}`
    }
    //选择合同承办人的回调
    const handleContractHandler = (user) => {
      console.log(user, 'handleContractHandler')
      contractForm.contractHandler = user.userId
      contractForm.contractHandlerName = `${user.cname}`
    }
    let result = []
    const ergodicArr = (arr, key, target) => {
      if (result.length != 0) {
        return result
      }
      arr?.forEach((element) => {
        if (element[key] == target) {
          result = element.children || []
          return
        }
        if (element.children) {
          return ergodicArr(element.children, key, target)
        }
      })
      return result
    }
    const projectRef = ref()

    const getProject = (row) => {
      data.projectDialog = false
      console.log(row, 'row')
      contractForm.projectId = row.id
      contractForm.projectName = row.projectName
      contractForm.projectMainDataCode = row.primaryDataNumber
      contractForm.projectLeader = row.projectLeader
      contractForm.projectLeaderName = row.projectLeaderName
      data.params.projectCodes = contractForm.projectMainDataCode
      const loading = servicesLoading({ text: '获取项目关联合同', fullscreen: true })
      getZhongziApi({
        path: '/itf/common/externalinterface/getContractCatalogue.json',
        cipherText: encryption(data.params),
      })
        .then((res) => {
          loading.close()
          console.log(res.data.data, 'res.data.data')
          data.contractList = res.data.data
          if (data.contractList.length == 0) {
            ElMessage({
              message: '该项目暂无关联合同',
              type: 'warning',
            })
          }
        })
        .catch(() => {
          loading.close()
        })
    }
    const handleDialog = (flag) => {
      console.log(flag)
      data.contractDialog = flag
    }
    //合同变化的回调
    const getContract = (contract) => {
      data.params.pk_contract_main = contract
      const loading = servicesLoading({ text: '加载合同数据', fullscreen: true })
      getZhongziApi({
        path: '/itf/common/externalinterface/getContractById.json',
        cipherText: encryption(data.params),
      })
        .then((res) => {
          loading.close()
          let contract = res.data.data[0]
          console.log(contract, 'getContract')
          contractForm.contractName = contract.contract_name //合同名称
          contractForm.contractNumber = contract.contract_no //合同编号
          contractForm.contractMainDataCode = contract.conmaincode //合同主数据编码
          contractForm.contractType = contract.contract_type + '' //合同类型
          //合同类型名称
          contractForm.contractTypeName = ergodicDickName(
            contractForm.contractType,
            contratDict.KHGL_HTGL_TYPE
          )
          contractForm.contractNature = contract.contract_property //合同性质
          //合同性质名称
          contractForm.contractNatureName = ergodicDickName(
            contractForm.contractNature,
            contratDict.KHGL_HTGL_NATURE
          )
          contractForm.originalContractName = contract.original_contract_name //原合同名称
          contractForm.originalContractMainDataCode = contract.supconmaincode //原合同主数据编码
          contractForm.contractAmendedTotalAmount = contract.hsbgamt //合同变更后总金额
          contractForm.applyingUnit = contract.apply_unit //申请单位
          //申请单位名称
          contractForm.applyingUnitName = ergodicTreeName(
            contractForm.applyingUnit,
            orgList,
            contractForm.applyingUnit,
            'id',
            'name'
          )

          contractForm.contractSigningMethodName = contract.contract_sign_type //合同签订方式
          contractForm.contractLanguage = contract.conlanguage //合同语言
          //合同语言名称
          contractForm.contractLanguageName = ergodicListName(
            contractForm.contractLanguage,
            store.state.projectCenter.conLanguage,
            'zlang_bib',
            'zlang_zh'
          )
          contractForm.partyA = contract.first_part_name
          contractForm.partyB = contract.second_part_name
          contractForm.involvesMultipleParties = contract.is_multi_party + '' //是否涉及多方
          contractForm.provisionalSum = (contract.provisionalmny/10000).toFixed(2) //暂定金
          contractForm.contractAmount = (contract.consign_contractmny/10000).toFixed(2) // 合同金额(万元)
          contractForm.taxRate = (contract.taxrate*1).toFixed(2) // 税率（%）
          contractForm.taxAmount = (contract.taxamt*1).toFixed(2) // 税额
          contractForm.contractNetAmount = (contract.contractcashmny/10000).toFixed(2) // 合同净额
          contractForm.projectUndertakingUnit = contract.prjbuild_unit // 项目承担单位
          // 项目承担单位名称
          contractForm.projectUndertakingUnitName = ergodicTreeName(
            contractForm.projectUndertakingUnit,
            allOrgList,
            contractForm.projectUndertakingUnit,
            'id',
            'name'
          )
          contractForm.businessSector = contract.busiplate // 业务版块
          // 业务版块名称
          contractForm.businessSectorName = ergodicDickName(
            contractForm.businessSector,
            contratDict.XMZX_HTGL_YWBK
          )
          contractForm.signingDate =
            contract.signdate != '' && contract.signdate != 'null'
              ? `${contract.signdate} 00:00:00`
              : '' //签订日期
          contractForm.stampingDate =
            contract.stamp_date != '' && contract.stamp_date != 'null'
              ? `${contract.stamp_date} 00:00:00`
              : '' //签订日期
          contractForm.scheduledStartDate =
            contract.planstartdate != '' && contract.planstartdate != 'null'
              ? `${contract.planstartdate} 00:00:00`
              : '' //规定开工日期
          contractForm.scheduledCompletionDate =
            contract.planenddate != '' && contract.planenddate != 'null'
              ? `${contract.planenddate} 00:00:00`
              : '' //规定完工日期
          //合同履行地(国家)名称
          contractForm.performanceCountry = contract.conperformcountry //合同履行地(国家)
          // contractForm.performanceCountry = ergodicListName(contractForm.performanceCountry,store.state.projectCenter.conRegion)
          //合同履行地(省)名称
          contractForm.performanceProvince = contract.conperformprovinces //合同履行地(省)
          // contractForm.performanceProvince = ergodicDickName(contractForm.performanceProvince,store.state.projectCenter.adminRegion)
          //合同履行地(市)名称
          contractForm.performanceCity = contract.conperformcity //合同履行地(市)
          // contractForm.performanceCity = ergodicDickName(contractForm.performanceCity,store.state.projectCenter.adminRegion)
          contractForm.projectStartProvince = contract.prj_startprovince //项目起点省
          //项目起点省名称
          contractForm.projectStartProvinceName = ergodicListName(
            contractForm.projectStartProvince,
            projectStartProvinceList,
            'regionCode',
            'regionName'
          )
          contractForm.projectStartCity = contract.prj_startcity //项目起点市
          //项目起点市名称
          contractForm.projectStartCityName = ergodicListName(
            contractForm.projectStartCity,
            data.projectStartCityList,
            'regionCode',
            'regionName'
          )
          contractForm.projectEndProvince = contract.prj_endprovince //项目终点省
          //项目终点省名称
          contractForm.projectEndProvinceName = ergodicListName(
            contractForm.projectEndProvince,
            projectStartProvinceList,
            'regionCode',
            'regionName'
          )
          contractForm.projectEndCity = contract.prj_endcity //项目终点市
          //项目终点市名称
          contractForm.projectEndCityName = ergodicListName(
            contractForm.projectEndCity,
            data.projectEndCityList,
            'regionCode',
            'regionName'
          )
          contractForm.mileage = contract.mileage //里程(KM)
          contractForm.businessType = contract.busitype //业务类型
          //业务类型名称
          contractForm.businessTypeNme = ergodicTreeName(
            contractForm.businessType,
            store.state.projectCenter.businessType,
            contractForm.businessType,
            'pk_busitype',
            'busitype_value'
          )
          contractForm.businessSubtype = contract.busitype_detail //业务类型细分
          //业务类型细分名称
          contractForm.businessSubtypeName = ergodicTreeName(
            contractForm.businessSubtype,
            store.state.projectCenter.businessType,
            contractForm.businessSubtype,
            'pk_busitype',
            'busitype_value'
          )
          contractForm.engineeringType = contract.projecttype //工程类型
          //工程类型名称
          contractForm.engineeringTypeName = ergodicDickName(
            contractForm.engineeringType,
            contratDict.KHGL_HTGL_ENGINEERING_TYPE
          )
          contractForm.engineeringPhase = contract.projectstage //工程阶段
          //工程阶段名称
          contractForm.engineeringPhaseName = ergodicDickName(
            contractForm.engineeringPhase,
            contratDict.KHGL_HTGL_ENGINEERING_PHASE
          )
          // contractForm.projectLeaderName = contract.charge_user //项目负责人
          contractForm.contractBusinessType = contract.contract_bustype //合同业务类型
          //合同业务类型名称
          contractForm.contractBusinessTypeName = ergodicTreeName(
            contractForm.contractBusinessType,
            store.state.projectCenter.conBusinessType,
            contractForm.contractBusinessType,
            'pk',
            'busitype_value'
          )
          contractForm.contractBusinessSubtype = contract.contract_bustype_detail //合同业务类型细分
          //合同业务类型细分名称
          contractForm.contractBusinessSubtypeName = ergodicTreeName(
            contractForm.contractBusinessSubtype,
            store.state.projectCenter.conBusinessType,
            contractForm.contractBusinessSubtype,
            'pk',
            'busitype_value'
          )
          // contractForm.contractFormType = contract.contract_billtype //合同表单类型
          contractForm.inpayType = contract.incomeexpendtype + '' //收支类型
          //收支类型名称
          contractForm.inpayTypeName = ergodicDickName(
            contractForm.inpayType,
            contratDict.KHGL_HTGL_PAY_TYPE
          )
          contractForm.disputeResolutionMethod = contract.disputesolutionway // 争议解决方式
          // 争议解决方式名称
          contractForm.disputeResolutionMethodName = ergodicDickName(
            contractForm.disputeResolutionMethod,
            contratDict.KHGL_HTGL_DISPUTE_METHOD
          )
          contractForm.contractTemplateUsage = contract.conmodelusecondition // 合同范本使用情况
          // 合同范本使用情况名称
          contractForm.contractTemplateUsageName = ergodicDickName(
            contractForm.contractTemplateUsage,
            contratDict.KHGL_HTGL_TEMPLATES_USE
          )
          console.log(152435124525);
          contractForm.contractHandlerName = contract.conundertaker // 合同承办人
          contractForm.contractHandlerContact = contract.conundertakercontact // 合同承办人联系方式
          contractForm.managementDepartment = contract.oname // 管理部门
          // 管理部门名称
          contractForm.managementDepartmentName = ergodicTreeName(
            contractForm.managementDepartment,
            allOrgList,
            contractForm.managementDepartment,
            'id',
            'name'
          )
          contractForm.actualPerformanceSubject = contract.sjlydwname // 合同实际履约主体
          contractForm.ourContractingPartyName = contract.partiesunitname // 我方签约单位
          // 我方签约单位名称
          // contractForm.ourContractingPartyName = ergodicTreeName(contractForm.ourContractingParty,orgList,contractForm.ourContractingParty,'id','name')

          contractForm.contractStatus = contract.constatus // 合同状态
          // 合同状态名称
          contractForm.contractStatus = ergodicDickName(
            contractForm.contractStatus,
            contratDict.XMZX_CONTRACT_STATUS
          )
          contractForm.totalAmountCurrency = contract.currency // 总金额币种
          contractForm.remarks = contract.memo // 备注
          contractForm.outputReportingMethod = contract.outputmode // 产值填报方式
          contractForm.incomeTypeName = contract.income_type // 收入类型
          contractForm.numberOfContractCopiesName = contract.contractnum // 持有合同份数
          contractForm.storageMethod = contract.stockin_type // 入库方式
          // 入库方式名称
          contractForm.storageMethodName = ergodicDickName(
            contractForm.storageMethod,
            contratDict.KHGL_HTGL_WAREHOUSING_METHOD
          )
          contractForm.useLegalPersonSeal = contract.islegalsignature // 是否使用法人章
          data.contractDialog = false
        })
        .catch(() => {
          loading.close()
        })
    }
    watch(
      () => contractForm.projectMainDataCode,
      () => {
        contractForm.contractName = ''
      }
    )
    // //监听国家值获取国家名称信息
    // watch(
    //   () => contractForm.performanceCountry,
    //   () => {
    //     console.log(contractForm.performanceCountry, 'changePerformanceCountry')
    //     store.state.projectCenter.allLocationList.forEach((obj) => {
    //       if (obj.regionCode == contractForm.performanceCountry) {
    //         contractForm.performanceCountry = obj.regionName
    //         console.log(contractForm.performanceCountry, 'contractForm.performanceCountry')
    //       }
    //     })
    //   }
    // )
    // // todo
    const changeBusinessType = () => {
      contractForm.businessSubtype = ''
      contractForm.businessSubtypeName = ''
      contractForm.businessTypeNme = ergodicTreeName(
        contractForm.businessType,
        store.state.projectCenter.businessType,
        contractForm.businessType,
        'pk_busitype',
        'busitype_value'
      )
    }
    const changeBusinessSubtype = () => {
      contractForm.businessSubtypeName = ergodicTreeName(
        contractForm.businessSubtype,
        store.state.projectCenter.businessType,
        contractForm.businessSubtype,
        'pk_busitype',
        'busitype_value'
      )
    }
    const changeConBusinessType = () => {
      contractForm.contractBusinessSubtype = ''
      contractForm.contractBusinessSubtypeName = ''
      contractForm.contractBusinessTypeName = ergodicTreeName(
        contractForm.contractBusinessType,
        store.state.projectCenter.conBusinessType,
        contractForm.contractBusinessType,
        'pk',
        'busitype_value'
      )
      console.log(contractForm.contractBusinessTypeName, 'changeConBusinessType')
    }
    const changeConBusinessSubtype = () => {
      contractForm.contractBusinessSubtypeName = ergodicTreeName(
        contractForm.contractBusinessSubtype,
        store.state.projectCenter.conBusinessType,
        contractForm.contractBusinessSubtype,
        'pk',
        'busitype_value'
      )
      console.log(contractForm.contractBusinessSubtypeName, 'changeConBusinessSubtype')
    }
    //监听业务类型生成对应业务细分类型列表
    watch(
      () => contractForm.businessType,
      () => {
        result = []
        if (store.state.projectCenter.businessType) {
          data.businessSubtypeList = ergodicArr(
            store.state.projectCenter.businessType,
            'pk_busitype',
            contractForm.businessType
          )
        }
      },
      {
        immediate: true,
      }
    )
    // todo
    //监听合同业务类型生成对应合同业务细分类型列表
    watch(
      () => contractForm.contractBusinessType,
      () => {
        result = []
        if (store.state.projectCenter.conBusinessType) {
          data.contractBusinessSubtypeList = ergodicArr(
            store.state.projectCenter.conBusinessType,
            'pk',
            contractForm.contractBusinessType
          )
        }
      },
      {
        immediate: true,
      }
    )
    const changeContractLanguage = () => {
      contractForm.contractLanguageName = ergodicListName(
        contractForm.contractLanguage,
        store.state.projectCenter.conLanguage,
        'zlang_bib',
        'zlang_zh'
      )
      console.log(contractForm.contractLanguageName,'changeContractLanguage');
    }
    const changeStartProvince = () => {
      contractForm.projectStartCity = ''
      contractForm.projectStartCityName = ''
      console.log(projectStartProvinceList,'projectStartProvinceList');
      
      contractForm.projectStartProvinceName = ergodicListName(
        contractForm.projectStartProvince,
        projectStartProvinceList,
        'regionCode',
        'regionName'
      )
    }
    const changeStartCity = () => {
      contractForm.projectStartCityName = ergodicListName(
        contractForm.projectStartCity,
        data.projectStartCityList,
        'regionCode',
        'regionName'
      )
    }
    const changeEndProvince = () => {
      contractForm.projectEndCity = ''
      contractForm.projectEndCityName = ''
      contractForm.projectEndProvinceName = ergodicListName(
        contractForm.projectEndProvince,
        projectStartProvinceList,
        'regionCode',
        'regionName'
      )
    }
    const changeEndCity = () => {
      contractForm.projectEndCityName = ergodicListName(
        contractForm.projectEndCity,
        data.projectEndCityList,
        'regionCode',
        'regionName'
      )
      console.log(contractForm.projectEndCity, 'contractForm.projectEndCity')
    }
    //监听起点省生成对应市列表
    watch(
      () => contractForm.projectStartProvince,
      () => {
        result = []
        data.projectStartCityList = ergodicArr(
          store.state.projectCenter.allLocationList,
          'regionCode',
          contractForm.projectStartProvince
        )
      },
      {
        immediate: true,
      }
    )
    // // const changeProjectEndProvince = (obj) => {
    // //   console.log(obj, 'changeProjectEndProvince')
    // //   data.projectEndCityList = obj.children
    // //   contractForm.projectEndCity = ''
    // // }
    //监听终点省生成对应市列表
    watch(
      () => contractForm.projectEndProvince,
      () => {
        result = []
        data.projectEndCityList = ergodicArr(
          store.state.projectCenter.allLocationList,
          'regionCode',
          contractForm.projectEndProvince
        )
      },
      {
        immediate: true,
      }
    )
    const disabledSigningDate = (time: Date) => {
      return time.getTime() > new Date(contractForm.stampingDate).getTime()
    }
    const disabledStampingDate = (time: Date) => {
      return time.getTime() < new Date(contractForm.signingDate).getTime()
    }
    const disabledStartDate = (time: Date) => {
      return time.getTime() > new Date(contractForm.scheduledCompletionDate).getTime()
    }
    const disabledEndDate = (time: Date) => {
      return time.getTime() < new Date(contractForm.scheduledStartDate).getTime()
    }
    //项目承担单位修改
    const handleProjectUndertakingUnit = (item) => {
      console.log(item, 'handleProjectUndertakingUnit')
      contractForm.projectUndertakingUnit = item.id
      contractForm.projectUndertakingUnitName = item.name
    }
    //申请单位修改
    const handleApplyingUnit = (item) => {
      console.log(item, 'handleApplyingUnit')
      contractForm.applyingUnit = item.id
      contractForm.applyingUnitName = item.name
    }
    //我方签约单位修改
    const handleOurContractingParty = (item) => {
      console.log(item, 'handleApplyingUnit')
      contractForm.ourContractingParty = item.id
      contractForm.ourContractingPartyName = item.name
    }
    const changeContractStatus = (value) => {
      console.log(value, 'changeContractStatus')
    }
    //管理部门修改
    const handleManagementDepartment = (item) => {
      console.log(item, 'handleManagementDepartment')
      contractForm.managementDepartment = item.id
      contractForm.managementDepartmentName = item.name
    }
    //收入类型修改
    const handleBusinessType = (item) => {
      console.log(item, 'handleBusinessType')
      contractForm.incomeType = item.id
      contractForm.incomeTypeName = item.name
    }
    const handleCurrency = () => {
      data.currencyDialog = true
    }
    const currencyRef = ref()
    const getCurrency = () => {
      let currencyList = currencyRef.value.hasChoose()
      if (currencyList.length == 1) {
        data.currencyDialog = false
        console.log(currencyList[0], 'currencyList[0]')
        contractForm.totalAmountCurrency = currencyList[0].zcurrencyName
      } else {
        ElMessage({
          message: '请选择一个币种',
          type: 'warning',
        })
      }
    }
    const submitForm = async () => {
      return new Promise((resolve, reject) => {
        ruleFormRef.value.validate((valid) => {
          console.log(valid, 'valid')
          if (valid) {
            resolve('校验成功')
          } else {
            ElMessage({
              message: '请将基本信息补充完整',
              type: 'warning',
            })
            reject('校验失败')
          }
        })
      })
    }
    return {
      data,
      store,
      rules,
      orgList,
      projectRef,
      currencyRef,
      contractForm,
      ruleFormRef,
      projectStartProvinceList,
      NumberCheck,
      ergodicArr,
      disabledSigningDate,
      disabledStampingDate,
      disabledStartDate,
      disabledEndDate,
      handleProjectLeader,
      handleContractHandler,
      handleProjectUndertakingUnit,
      handleApplyingUnit,
      handleManagementDepartment,
      changeContractStatus,
      handleOurContractingParty,
      handleBusinessType,
      handleProject,
      handleContract,
      handleDialog,
      submitForm,
      getContract,
      getProject,
      changeContractLanguage,
      changeStartProvince,
      changeStartCity,
      changeEndProvince,
      changeEndCity,
      changeBusinessType,
      changeBusinessSubtype,
      changeConBusinessType,
      changeConBusinessSubtype,
      handleCurrency,
      getCurrency,
    }
  },
  beforeUnmount() {
    console.log('beforeUasdasdnmount')
    for (let key in this.contractForm) {
      this.contractForm[key] = ''
    }
    this.contractForm.contractPlanList = []
    this.contractForm.contractBudgetList = []
  },
})
</script>
<style lang="scss" scoped>
.box {
  max-height: 500px;
  overflow: auto;
}
.demo-form-inline .el-form-item {
  width: 23%;
}
.demo-form-inline .page-list {
  width: 47%;
  .choose-btn {
    margin-left: 10px;
  }
}
:deep(.demo-form-inline .el-form-item--small .el-form-item__content) {
  display: flex !important;
}
:deep(.el-cascader--small) {
  width: 100%;
}

/deep/.labelHeight .el-form-item__label {
  line-height: 20px;
}

/deep/.el-date-editor.el-input {
  width: 100%;
}

/deep/.el-date-editor.el-input__inner {
  width: 100%;
}

/deep/.demo-form-inline .el-select {
  width: 100%;
  margin: 0;
}

.el-select {
  width: 100%;
  margin: 0;
}

.selectLabel {
  width: 70%;
  height: 40px;
  line-height: 40px;
  padding: 0 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  display: inline-block;
}

.radio {
  display: flex;
  margin-top: 10px;
}
:deep(.el-form--label-top .el-form-item__label) {
  padding: 0;
}
</style>
